import http from "@/utils/http.ts";
import {R} from "@/api/common.ts";
import {Base, Quality} from "@/api/baseQuality.ts";

enum Router {
    provinces = "provinces",
    history = "provinces/history",
    health = "provinces/health",
    predict="provinces/predict",
}

export interface Province {
    id: number;
    provinceCode: number;
    provinceName: string;
    provinceJc: string;
}

export function getProvinces() {
    return http<R<Province[]>>({
        url: Router.provinces,
        method: 'get'
    })
}

export interface ProvinceHistory {
    id: number;
    type: number;
}

export interface ProvinceQuality extends Quality{
    id: number;
}

export function getProvinceHistory(data: ProvinceHistory) {
    return http<R<ProvinceQuality[]>>({
        url: Router.history,
        method: 'post',
        data
    })
}

export function getProvinceHealth(id: number) {
    return http<R<ProvinceQuality[]>>({
        url: `${Router.health}/${id}`,
        method: 'get'
    })
}

export function getProvincePredict(id:number) {
    return http<R<Base[]>>({
        url: `${Router.predict}/${id}`,
        method: 'get'
    })
}

export function getProvinceRealTime() {
    return http<R<ProvinceQuality[]>>({
        url: `${Router.provinces}/realTime`,
        method: 'get'
    })
}

// export interface AreaPro {
//     id: number;
//     provinceCode: number;
//     provinceName: string;
//     provinceJc: string;
//     cityCode: number;
//     cityName: string;
//     cityJc: string;
//     countyCode: number;
//     countyName: string;
//     countyJc: string;
// }